--- import Layout from '../../layouts/Layout.astro'; import ProductCard from '../../components/ProductCard.astro'; import { getProductsFromDB, getProductCountByMaxPrice } from '../../lib/products'; const { price: priceParam } = Astro.params; const maxPrice = parseInt(priceParam!); // Validate price (50-500 in steps of 25) if (isNaN(maxPrice) || maxPrice < 25 || maxPrice > 500) return Astro.redirect('/sneakers'); const url = Astro.url; const sort = (url.searchParams.get('sort') || 'price_asc') as 'popular' | 'newest' | 'price_asc' | 'price_desc' | 'discount'; const page = Math.max(1, parseInt(url.searchParams.get('pagina') || '1')); const perPage = 36; const products = await getProductsFromDB({ limit: perPage, offset: (page - 1) * perPage, orderBy: sort, maxPrice, }); const totalCount = await getProductCountByMaxPrice(maxPrice); const totalPages = Math.ceil(totalCount / perPage); const priceSteps = [50, 75, 100, 125, 150, 200, 250, 300]; const title = `Sneakers onder €${maxPrice} — ${totalCount}+ modellen | SneakerPicks`; const description = `Sneakers onder de €${maxPrice}: vergelijk ${totalCount}+ betaalbare sneakers van Nike, Adidas, New Balance en meer. Vind de beste deals.`; const breadcrumbs = [ { name: 'Home', url: 'https://sneakerpicks.nl/' }, { name: 'Sneakers', url: 'https://sneakerpicks.nl/sneakers' }, { name: `Onder €${maxPrice}`, url: `https://sneakerpicks.nl/sneakers/onder-${maxPrice}` }, ]; --- 1}>